import { http, ResponseData } from '../http'
import { AxiosPromise } from 'axios'
 
interface IQuery {
  page?: number;
  pageSize?: number
}

// 获取项目列表
export const getList = (data: IQuery): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'GET',
    url: '/v1/project',
    data,
  })
}

// 删除项目
export const deleteById = (id: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'DELETE',
    url: `/v1/project/${id}`,
  })
}

// 添加项目
export const add = (data: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'POST',
    url: '/v1/project',
    data,
  })
}

// 编辑
export const edit = (data: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'PUT',
    url: '/v1/project',
    data,
  })
}

// 获取项目详情
export const getDetail = (id: any): AxiosPromise<ResponseData> => {
  return http.request({
    method: 'GET',
    url: `/v1/project/${id}`,
  })
}